Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the saturated addition panic inside IPA #1286

Merged
merged 5 commits into from
Sep 19, 2024

Conversation

akoshelev
Copy link
Collaborator

This fixes #1285. It was a silly error where the code used 32 bit step, but the compact gate declaration pointed to 16 bit. I spent the majority of the time actually reproducing this error in a unit test and making compact gate work with in-memory infra to allow people to write more of them.

So this PR essentially brings a test to reproduce the issue, runs more things with compact gate enabled and adds yet another approval step to the CI. It also fixes compile errors that we had for long time with compact gate and in memory infrastructure. Those errors stayed in the code because we never ran it with compact gate

It required quite a bit of plumbing to make the compact gate stuff work
    Otherwise, I can't make it work with compact gate `track_steps`.
    It could be possible if we include stuff from `test_fixture` folder
    conditionally, but `track_steps` does not support that currently.
@akoshelev
Copy link
Collaborator Author

Copy link

codecov bot commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 98.90110% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.70%. Comparing base (b511821) to head (6d7c1d2).
Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
ipa-step/src/gate.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1286      +/-   ##
==========================================
+ Coverage   93.69%   93.70%   +0.01%     
==========================================
  Files         203      202       -1     
  Lines       33270    33333      +63     
==========================================
+ Hits        31171    31234      +63     
  Misses       2099     2099              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@eriktaubeneck eriktaubeneck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice find, and great to be able to build more tests with compact gate.

ipa-core/src/protocol/ipa_prf/mod.rs Show resolved Hide resolved
},
];
let dp_params = DpMechanism::NoDp;
let padding_params = PaddingParameters::relaxed();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this happen by default when testing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what you mean by that. We have to supply this padding_params parameter for oprf_ipa, so we need to pick an explicit value (Rust does not support default values for function parameters)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it. I was thinking this was gated by feature flags, but I suppose that just means this is unavailable without that flag.


#[test]
fn saturated_agg() {
const EXPECTED: &[u128] = &[0, 255, 255, 0, 0, 0, 0, 0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're trying to test going from 2 bytes to 4, shouldn't we test some much bigger numbers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the histogram value is 1 byte wide, so we definitely hit overflow with this test data which was our goal for this test. Any deviation from "standard" 8 bit trigger values requires transpose plumbing which seemed unnecessary here

ipa-core/src/secret_sharing/into_shares.rs Show resolved Hide resolved
@@ -614,6 +614,8 @@ impl_transpose_shares_bool_to_ba!(BA32, 32, 256, test_transpose_shares_bool_to_b
impl_transpose_shares_bool_to_ba_small!(BA8, 8, 32, test_transpose_shares_bool_to_ba_8x32);
// added to support HV = BA32 to hold results when adding Binomial noise
impl_transpose_shares_bool_to_ba_small!(BA32, 32, 32, test_transpose_shares_bool_to_ba_32x32);
// // Usage: IPA test case for saturated additions
// impl_transpose_shares_bool_to_ba_small!(BA3, 3, 32, test_transpose_shares_bool_to_ba_3x32);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentionally commented out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

late night PR :( thanks for catching it!

@akoshelev
Copy link
Collaborator Author

akoshelev commented Sep 19, 2024

wrong link for Draft (still does not work for malicious security): https://draft-mpc.vercel.app/query/view/such-mitt2024-09-19T1629

https://draft-mpc.vercel.app/query/view/gory-waft2024-09-19T1639 - 1M rows with semi-honest security on this branch (passed)

@akoshelev akoshelev merged commit 2e04060 into private-attribution:main Sep 19, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IPA run fails on 1M records
2 participants